

package cn.iocoder.yudao.module.apijson.framework;

import cn.iocoder.yudao.module.apijson.framework.service.ApiJsonService;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


@RestController
@Slf4j
public class APIJSONController {
    @Resource
    private ApiJsonService apiJsonService;

    @PostMapping("/apijson/reload")
    public JSONObject reload(@RequestBody String type) {
        return apiJsonService.reload(type);
    }

    @PostMapping("/apijson/get")
    public String get(@RequestBody String request) {
        return apiJsonService.get(request);
    }

    @PostMapping("/apijson/get/{tag}")
    public String getByTag(@PathVariable String tag, @RequestBody String request) {
        return apiJsonService.getByTag(tag, request);
    }

    @PostMapping("/apijson/head")
    public String head(@RequestBody String request) {
        return apiJsonService.head(request);
    }

    @PostMapping("/apijson/gets")
    public String gets(@RequestBody String request) {
        return apiJsonService.gets(request);
    }

    @PostMapping("/apijson/heads")
    public String heads(@RequestBody String request) {
        return apiJsonService.heads(request);
    }

    @PostMapping("/apijson/post")
    public String post(@RequestBody String request) {
        return apiJsonService.post(request);
    }

    @PostMapping("/apijson/post/{tag}")
    public String postByTag(@PathVariable String tag, @RequestBody String request) {
        return apiJsonService.postByTag(tag, request);
    }

    @PostMapping("/apijson/put")
    public String put(@RequestBody String request) {
        return apiJsonService.put(request);
    }

    @PostMapping("/apijson/put/{tag}")
    public String putByTag(@PathVariable String tag, @RequestBody String request) {
        return apiJsonService.putByTag(tag, request);
    }

    @PostMapping("/apijson/delete")
    public String delete(@RequestBody String request) {
        return apiJsonService.delete(request);
    }

    @PostMapping("/apijson/delete/{tag}")
    public String deleteByTag(@PathVariable String tag, @RequestBody String request) {
        return apiJsonService.deleteByTag(tag, request);
    }

    @PostMapping("/apijson/crud")
    public String crud(@RequestBody String request) {
        return apiJsonService.crud(request);
    }
}
